<?php
    include "../../fun.php";
    isLogin();
    $db=conndb();
    $limit=isset($_GET["limit"])?$_GET["limit"]:5;
    $page=isset($_GET["page"])?$_GET["page"]:1;
    $sql_count="select count(*) as count from message";
    $res_count=query1($db, $sql_count, false);
    $count=$res_count["count"];
    $start=($page-1)*$limit;
    $sql="select * from message order by id desc limit {$start},{$limit}";
    $res=query1($db,$sql);
    $data=["code"=>0,"msg"=>"操作成功","data"=>$res,"count"=>$count];
    echo json_encode($data,JSON_UNESCAPED_UNICODE);
?>